<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <link type="image/x-icon" href="assets/favicon.png" rel="shortcut icon">
  <title>算一下你活了多长时间</title>
  <link rel="stylesheet" href="assets/base.css">
  <link rel="stylesheet" href="assets/index.css">
</head>
<body>
  <div id="app">
    <label>
      出生日期：
      <input
        class="birthday"
        type="number"
        v-model="birthday"
        :placeholder="placeholder"
      >
    </label>
  </div>
  <script src="https://unpkg.com/vue@2.6.10/dist/vue.min.js"></script>
  <script>
    new Vue({
      el: '#app',
      data: {
        birthday: ''
      },
      computed: {
        placeholder: function(){
          var d = new Date();
          var year = d.getFullYear();
          var month = ('0' + (d.getMonth() + 1)).slice(-2);
          var day = ('0' + d.getDate()).slice(-2);
          return year + month + day;
        }
      }
    });
  </script>
</body>
</html>